// ignore_for_file: non_constant_identifier_names
import 'package:car_music/src/tool/assets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_kit_dsp/flutter_kit_dsp.dart';

import '../../commont/kcontainer.dart';

class ChartPage extends GetView<GetxGlobalController> {
  int flex = 0;
  ChartPage({super.key, required this.flex});
  List<double> _freqsForX = [];
  @override
  Widget build(BuildContext context) {
    return Flexible(
      flex: flex,
      child: kContainer(
        child: Container(
          padding: const EdgeInsets.all(1),
          child: kContainer(
            child: LayoutBuilder(
              builder: (BuildContext context, BoxConstraints constrains) {
                ///计算绘图的真实宽度，高度
                var size = Size(constrains.maxWidth, constrains.maxHeight);
                var padding = const EdgeInsets.only(left: 28, right: 10, top: 5, bottom: 20);
                return Obx(() {
                  return ChartView(
                      x_line_color: Color_border,
                      y_line_color: Color_border,
                      label_color: Color_border,
                      border_color: Color_border,
                      ch: controller.rxModel.value.current_ch,
                      size: size,
                      padding: padding,
                      minY: -12,
                      maxY: 12);
                });
              },
            ),
          ),
        ),
      ),
    );
  }
}
